#include "highlighters.h"

void QAceHighlighters::InitHighlighters() {
  THighlighter h;
  h.displayName = "abc";
  h.fileExt = "abc";
  highlighters.append(h);
  h.displayName = "abap";
  h.fileExt = "abap";
  highlighters.append(h);
  h.displayName = "actionscript";
  h.fileExt = "as";
  highlighters.append(h);
  h.displayName = "ada";
  h.fileExt = "ada|adb";
  highlighters.append(h);
  h.displayName = "apache_conf";
  h.fileExt = "^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd";
  highlighters.append(h);
  h.displayName = "asciidoc";
  h.fileExt = "asciidoc|adoc";
  highlighters.append(h);
  h.displayName = "assembly_x86";
  h.fileExt = "asm";
  highlighters.append(h);
  h.displayName = "autohotkey";
  h.fileExt = "ahk";
  highlighters.append(h);
  h.displayName = "batchfile";
  h.fileExt = "bat|cmd";
  highlighters.append(h);
  h.displayName = "c9search";
  h.fileExt = "c9search_results";
  highlighters.append(h);
  h.displayName = "c_cpp";
  h.fileExt = "cpp|c|cc|cxx|h|hh|hpp";
  highlighters.append(h);
  h.displayName = "cirru";
  h.fileExt = "cirru|cr";
  highlighters.append(h);
  h.displayName = "clojure";
  h.fileExt = "clj|cljs";
  highlighters.append(h);
  h.displayName = "cobol";
  h.fileExt = "CBL|COB";
  highlighters.append(h);
  h.displayName = "coffee";
  h.fileExt = "coffee|cf|cson|^Cakefile";
  highlighters.append(h);
  h.displayName = "coldfusion";
  h.fileExt = "cfm";
  highlighters.append(h);
  h.displayName = "csharp";
  h.fileExt = "cs";
  highlighters.append(h);
  h.displayName = "css";
  h.fileExt = "scss";
  highlighters.append(h);
  h.displayName = "curly";
  h.fileExt = "curly";
  highlighters.append(h);
  h.displayName = "d";
  h.fileExt = "html";
  highlighters.append(h);
  h.displayName = "dart";
  h.fileExt = "dart";
  highlighters.append(h);
  h.displayName = "diff";
  h.fileExt = "diff|patch";
  highlighters.append(h);
  h.displayName = "django";
  h.fileExt = "html";
  highlighters.append(h);
  h.displayName = "dockerfile";
  h.fileExt = "^Dockerfile";
  highlighters.append(h);
  h.displayName = "dot";
  h.fileExt = "dot";
  highlighters.append(h);
  h.displayName = "eiffel";
  h.fileExt = "e";
  highlighters.append(h);
  h.displayName = "ejs";
  h.fileExt = "ejs";
  highlighters.append(h);
  h.displayName = "elixir";
  h.fileExt = "ex|exs";
  highlighters.append(h);
  h.displayName = "elm";
  h.fileExt = "elm";
  highlighters.append(h);
  h.displayName = "erlang";
  h.fileExt = "erl|hrl";
  highlighters.append(h);
  h.displayName = "forth";
  h.fileExt = "frt|fs|ldr";
  highlighters.append(h);
  h.displayName = "ftl";
  h.fileExt = "ftl";
  highlighters.append(h);
  h.displayName = "gcode";
  h.fileExt = "gcode";
  highlighters.append(h);
  h.displayName = "gherkin";
  h.fileExt = "feature";
  highlighters.append(h);
  h.displayName = "gitignore";
  h.fileExt = "^.gitignore";
  highlighters.append(h);
  h.displayName = "ini";
  h.fileExt = "ini|conf|cfg|prefs";
  highlighters.append(h);
  h.displayName = "glsl";
  h.fileExt = "glsl|frag|vert";
  highlighters.append(h);
  h.displayName = "golang";
  h.fileExt = "go";
  highlighters.append(h);
  h.displayName = "groovy";
  h.fileExt = "groovy";
  highlighters.append(h);
  h.displayName = "haml";
  h.fileExt = "haml";
  highlighters.append(h);
  h.displayName = "handlebars";
  h.fileExt = "hbs|handlebars|tpl|mustache";
  highlighters.append(h);
  h.displayName = "haskell";
  h.fileExt = "hs";
  highlighters.append(h);
  h.displayName = "haxe";
  h.fileExt = "hx";
  highlighters.append(h);
  h.displayName = "html";
  h.fileExt = "html";
  highlighters.append(h);
  h.displayName = "html_ruby";
  h.fileExt = "erb|rhtml|html.erb";
  highlighters.append(h);
  h.displayName = "io";
  h.fileExt = "io";
  highlighters.append(h);
  h.displayName = "jack";
  h.fileExt = "jack";
  highlighters.append(h);
  h.displayName = "jade";
  h.fileExt = "jade";
  highlighters.append(h);
  h.displayName = "java";
  h.fileExt = "js|jsm";
  highlighters.append(h);
  h.displayName = "javascript";
  h.fileExt = "js|jsm";
  highlighters.append(h);
  h.displayName = "json";
  h.fileExt = "jq";
  highlighters.append(h);
  h.displayName = "jsoniq";
  h.fileExt = "jq";
  highlighters.append(h);
  h.displayName = "jsp";
  h.fileExt = "jsp";
  highlighters.append(h);
  h.displayName = "jsx";
  h.fileExt = "jsx";
  highlighters.append(h);
  h.displayName = "julia";
  h.fileExt = "jl";
  highlighters.append(h);
  h.displayName = "latex";
  h.fileExt = "tex|latex|ltx|bib";
  highlighters.append(h);
  h.displayName = "lean";
  h.fileExt = "lean|hlean";
  highlighters.append(h);
  h.displayName = "less";
  h.fileExt = "less";
  highlighters.append(h);
  h.displayName = "liquid";
  h.fileExt = "liquid";
  highlighters.append(h);
  h.displayName = "lisp";
  h.fileExt = "lisp";
  highlighters.append(h);
  h.displayName = "livescript";
  h.fileExt = "ls";
  highlighters.append(h);
  h.displayName = "logiql";
  h.fileExt = "logic|lql";
  highlighters.append(h);
  h.displayName = "lsl";
  h.fileExt = "lsl";
  highlighters.append(h);
  h.displayName = "lua";
  h.fileExt = "lp";
  highlighters.append(h);
  h.displayName = "luapage";
  h.fileExt = "lp";
  highlighters.append(h);
  h.displayName = "lucene";
  h.fileExt = "lucene";
  highlighters.append(h);
  h.displayName = "makefile";
  h.fileExt = "^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make";
  highlighters.append(h);
  h.displayName = "markdown";
  h.fileExt = "md|markdown";
  highlighters.append(h);
  h.displayName = "mask";
  h.fileExt = "mask";
  highlighters.append(h);
  h.displayName = "matlab";
  h.fileExt = "matlab";
  highlighters.append(h);
  h.displayName = "mel";
  h.fileExt = "mel";
  highlighters.append(h);
  h.displayName = "mushcode";
  h.fileExt = "mc|mush";
  highlighters.append(h);
  h.displayName = "mysql";
  h.fileExt = "mysql";
  highlighters.append(h);
  h.displayName = "nix";
  h.fileExt = "nix";
  highlighters.append(h);
  h.displayName = "objectivec";
  h.fileExt = "m|mm";
  highlighters.append(h);
  h.displayName = "ocaml";
  h.fileExt = "ml|mli";
  highlighters.append(h);
  h.displayName = "pascal";
  h.fileExt = "pas|p";
  highlighters.append(h);
  h.displayName = "perl";
  h.fileExt = "pl|pm";
  highlighters.append(h);
  h.displayName = "pgsql";
  h.fileExt = "pgsql";
  highlighters.append(h);
  h.displayName = "php";
  h.fileExt = "php|phtml";
  highlighters.append(h);
  h.displayName = "powershell";
  h.fileExt = "ps1";
  highlighters.append(h);
  h.displayName = "praat";
  h.fileExt = "praat|praatscript|psc|proc";
  highlighters.append(h);
  h.displayName = "prolog";
  h.fileExt = "plg|prolog";
  highlighters.append(h);
  h.displayName = "properties";
  h.fileExt = "properties";
  highlighters.append(h);
  h.displayName = "protobuf";
  h.fileExt = "proto";
  highlighters.append(h);
  h.displayName = "python";
  h.fileExt = "py";
  highlighters.append(h);
  h.displayName = "r";
  h.fileExt = "xq";
  highlighters.append(h);
  h.displayName = "rdoc";
  h.fileExt = "Rd";
  highlighters.append(h);
  h.displayName = "rhtml";
  h.fileExt = "Rhtml";
  highlighters.append(h);
  h.displayName = "ruby";
  h.fileExt = "rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile";
  highlighters.append(h);
  h.displayName = "rust";
  h.fileExt = "rs";
  highlighters.append(h);
  h.displayName = "sass";
  h.fileExt = "sass";
  highlighters.append(h);
  h.displayName = "scad";
  h.fileExt = "scad";
  highlighters.append(h);
  h.displayName = "scala";
  h.fileExt = "scala";
  highlighters.append(h);
  h.displayName = "scheme";
  h.fileExt = "scm|rkt";
  highlighters.append(h);
  h.displayName = "scss";
  h.fileExt = "scss";
  highlighters.append(h);
  h.displayName = "sh";
  h.fileExt = "sh|bash|^.bashrc";
  highlighters.append(h);
  h.displayName = "sjs";
  h.fileExt = "sjs";
  highlighters.append(h);
  h.displayName = "smarty";
  h.fileExt = "smarty|tpl";
  highlighters.append(h);
  h.displayName = "snippets";
  h.fileExt = "snippets";
  highlighters.append(h);
  h.displayName = "soy_template";
  h.fileExt = "soy";
  highlighters.append(h);
  h.displayName = "space";
  h.fileExt = "space";
  highlighters.append(h);
  h.displayName = "sql";
  h.fileExt = "sqlserver";
  highlighters.append(h);
  h.displayName = "sqlserver";
  h.fileExt = "sqlserver";
  highlighters.append(h);
  h.displayName = "stylus";
  h.fileExt = "styl|stylus";
  highlighters.append(h);
  h.displayName = "svg";
  h.fileExt = "svg";
  highlighters.append(h);
  h.displayName = "tcl";
  h.fileExt = "tcl";
  highlighters.append(h);
  h.displayName = "tex";
  h.fileExt = "textile";
  highlighters.append(h);
  h.displayName = "text";
  h.fileExt = "textile";
  highlighters.append(h);
  h.displayName = "textile";
  h.fileExt = "textile";
  highlighters.append(h);
  h.displayName = "toml";
  h.fileExt = "toml";
  highlighters.append(h);
  h.displayName = "twig";
  h.fileExt = "twig";
  highlighters.append(h);
  h.displayName = "typescript";
  h.fileExt = "ts|typescript|str";
  highlighters.append(h);
  h.displayName = "vala";
  h.fileExt = "vala";
  highlighters.append(h);
  h.displayName = "vbscript";
  h.fileExt = "vbs|vb";
  highlighters.append(h);
  h.displayName = "velocity";
  h.fileExt = "vm";
  highlighters.append(h);
  h.displayName = "verilog";
  h.fileExt = "v|vh|sv|svh";
  highlighters.append(h);
  h.displayName = "vhdl";
  h.fileExt = "vhd|vhdl";
  highlighters.append(h);
  h.displayName = "xml";
  h.fileExt = "xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml";
  highlighters.append(h);
  h.displayName = "xquery";
  h.fileExt = "xq";
  highlighters.append(h);
  h.displayName = "yaml";
  h.fileExt = "yaml|yml";
  highlighters.append(h);
}

int QAceHighlighters::GetCount() {
    return highlighters.count();
}

THighlighter QAceHighlighters::GetHighlighter(int index) {
    return highlighters.at(index);
}

int QAceHighlighters::GetHighlighterByName(QString name) {
  int i;
  int res = -1;
  for(i=0;i<highlighters.count();i++) {
    if(highlighters.at(i).displayName == name) res = i;
  }
  return res;
}

int QAceHighlighters::GetHighlighterByExt(QString ext) {
    int i;
    int res = -1;
    for(i=0;i<highlighters.count();i++) {
        QStringList fparts = highlighters.at(i).fileExt.split("|");
        if(fparts.contains(ext,Qt::CaseInsensitive)) res = i;
    }
    return res;
}

